USE ConsultTracking
GO
drop proc CreateInvoice
drop proc CreateInvoiceTask
drop proc CreateInvoicePO
drop proc UpdateInvoice
drop proc UpdateInvoiceTask
drop proc UpdateInvoicePO
GO
------------------------------------------------------------------
create proc CreateInvoice
@JobID int,
@Description nvarchar(100)
as
INSERT INTO [ConsultTracking].[dbo].[Invoice]
           ([JobID]
           ,[Description])
     VALUES
           (@JobID
           ,@Description)
---------------------------------------------------------------------
go
create proc UpdateInvoice
@InvoiceID int,
@Description nvarchar(100)
as
UPDATE [ConsultTracking].[dbo].[Invoice]
   SET [Description] = @Description
	  ,[Modified] = GETDATE()
 WHERE InvoiceID = @InvoiceID
----------------------------------------------------------------------
go
create proc CreateInvoicePO
@InvoiceID int,
@Description nvarchar(100),
@Price decimal(8,2)
as
INSERT INTO [ConsultTracking].[dbo].[InvoicePO]
           ([InvoiceID]
           ,[Description]
           ,[Price])
     VALUES
           (@InvoiceID
           ,@Description
           ,@Price)
----------------------------------------------------------------------
go
create proc UpdateInvoicePO
@InvoicePoID int,
@Description nvarchar(100),
@Price decimal(8,2)
as
UPDATE [ConsultTracking].[dbo].[InvoicePO]
   SET [Description] = @Description
      ,[Price] = @Price
 	  ,[Modified] = GETDATE()
WHERE InvoicePoID = @InvoicePoID
-----------------------------------------------------------------------
go
create proc CreateInvoiceTask
@InvoiceID int,
@Description nvarchar(100),
@TimeBilled decimal(4,2)
as
INSERT INTO [ConsultTracking].[dbo].[InvoiceTask]
           ([InvoiceID]
           ,[Description]
           ,[TimeBilled])
     VALUES
           (@InvoiceID
           ,@Description
           ,@TimeBilled)
-----------------------------------------------------------------------
go
create proc UpdateInvoiceTask
@InvoiceTaskID int,
@Description nvarchar(100),
@TimeBilled decimal(4,2)
as
UPDATE [ConsultTracking].[dbo].[InvoiceTask]
   SET [Description] = @Description
      ,[TimeBilled] = @TimeBilled
 	  ,[Modified] = GETDATE()
WHERE InvoiceTaskID = @InvoiceTaskID